<%--
  User: Hystar
  Date: 2022/11/18
  Time: 15:01
  description: book_record_list Deal
--%>
<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>借阅管理</title>
</head>
<body>
<%
    if (request.getSession().getAttribute("borrowBook_message") != null) {
        out.print("<script>alert(\"" + (request.getSession().getAttribute("borrowBook_message")) + "\");</script>"); // 弹窗提示
        request.getSession().removeAttribute("borrowBook_message"); // 删除会话
    } else if (request.getSession().getAttribute("back_message") != null) {
        out.print("<script>alert(\"" + (request.getSession().getAttribute("back_message")) + "\");</script>"); // 弹窗提示
        request.getSession().removeAttribute("back_message"); // 删除会话
    }
%>

<%
    ArrayList bookRecordList = (ArrayList) request.getAttribute("bookRecordList");
    if (bookRecordList != null && bookRecordList.size() > 0) {
%>
<a href="${pageContext.request.contextPath}/admin/index.jsp">返回主页</a>
<table border="1" cellspacing="0px" cellpadding="5px" width="1400px">
    <tr>
        <th>ID</th>
        <th>书本ID</th>
        <th>书名</th>
        <th>用户ID</th>
        <th>借书日期</th>
        <th>还书日期</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${requestScope.bookRecordList}" var="bookRecordList">
        <tr>
            <td>${bookRecordList.id}</td>
            <td>${bookRecordList.bookId}</td>
            <td>${bookRecordList.bookName}</td>
            <td>${bookRecordList.userId}</td>
            <td>${bookRecordList.rentDate}</td>
            <td>${bookRecordList.backDate}</td>
            <td>
                <a href="<c:url value="/admin/AdminRecord?method=backBook&id=${bookRecordList.id}"/>">还书</a>
            </td>
        </tr>
    </c:forEach>
</table>
<%
    }
%>
</body>
</html>
